<script type="text/javascript" src="jquery/jquery.validate.js"></script>
<div>
	<div style="height:90.7%">
			<br>
			<br>
			<div class="layui-form-item" style="margin-left: 7%;">
				<label class="layui-form-label">城市名称:</label>
				<div class="layui-form-block">
					<input type="text" class="layui-input" id="LOCATION_NAME" name="LOCATION_NAME"
						style="width:60%" />
				</div>
			</div>
			<div class="layui-form-item" style="margin-left: 7%;">
				<label class="layui-form-label">城市描述 :</label>
				<div class="layui-form-block">
					<input type="text" id="LOCATION_DESC" name="LOCATION_DESC" class="layui-input"
						style="width:60%"/>
				</div>
			</div>
			<div style="background: #f2f2f2;height:40px;margin-top: 26px;">
			<button class="layui-btn" style="margin-left:35%;" lay-submit lay-filter="MenuSave">保存</button>
			<button class="layui-btn" onclick="layer.closeAll();" style="margin-left: 35px;">关闭</button>
		</div>
	</div>
</div>
<script>
	layui.use('form',function(){
		var form = layui.form;
		form.render();
		//监听提交按钮
		form.on('submit(MenuSave)',function(){
			var location_name = $("#LOCATION_NAME").val();
			var location_desc = $("#LOCATION_DESC").val();
			$.ajax({
				type:"POST",
				url:'/location/addRoot',
				data:{"name":location_name,
					"desc":location_desc		
				},
				success:function(data){
					layer.msg(data);
					treeutil.treeinit("#treemenu", setting);
					var time = setTimeout(function(){
						layer.closeAll();
					},1000);
					cleansetTimeout(time);
				},
				error:function(){
					layer.msg("添加错误！")
				}
			});
			return false;
		})
	})
</script>
